﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SnmpForm.APConfig
{

    public class ApConfigItem
    {
        private string _text = null;
        private object _value = null;

        public ApConfigItem(string text, object value)
        {
            // TODO: Complete member initialization
            this._text = text;
            this._value = value;
        }
        public string Text { get { return this._text; } set { this._text = value; } }
        public object Value { get { return this._value; } set { this._value = value; } }
        public override string ToString()
        {
            return this._text;
        }
    }

    class AP_DEFINE_DATA
    {
        static public ApConfigItem[] 
            WIRELESS_CHANNALS = { new ApConfigItem("自动", 0), 
                                    new ApConfigItem("1", 1), 
                                    new ApConfigItem("2", 2), 
                                    new ApConfigItem("3", 3), 
                                    new ApConfigItem("4", 4), 
                                    new ApConfigItem("5", 5), 
                                    new ApConfigItem("6", 6), 
                                    new ApConfigItem("7", 7), 
                                    new ApConfigItem("8", 8), 
                                    new ApConfigItem("9",9), 
                                    new ApConfigItem("10", 10), 
                                    new ApConfigItem("11", 11) };
                                                            
        static public ApConfigItem[]
            WIRELESS_MODE = { new ApConfigItem("11b only", "11b only"), 
                                new ApConfigItem("11g only", "11g only"), 
                                new ApConfigItem("11gn HT20 (推荐)", "11gn HT20"), 
                                new ApConfigItem("11gn HT40+", "11gn HT40+"), 
                                new ApConfigItem("11gn HT40-", "11gn HT40-" )};
        static public ApConfigItem[] 
            WIRELESS_CWD = { new ApConfigItem("自动", 1), 
                                new ApConfigItem("20MHZ", 0), 
                                new ApConfigItem("40MHZ", 2) };
        static public ApConfigItem[] 
            WIRELESS_POWER = {new ApConfigItem("1 dBm", 1), new ApConfigItem("2 dBm", 2), 
                                 new ApConfigItem("3 dBm", 3),  new ApConfigItem("4 dBm", 4), 
                                 new ApConfigItem("5 dBm", 5), new ApConfigItem("6 dBm", 6), 
                                 new ApConfigItem("7 dBm", 7),  new ApConfigItem("8 dBm", 8), 
                                 new ApConfigItem("9 dBm", 9), new ApConfigItem("10 dBm", 10),
                                 new ApConfigItem("11 dBm", 11),new ApConfigItem("12 dBm", 12), 
                                 new ApConfigItem("13 dBm", 13), new ApConfigItem("14 dBm", 14), 
                                 new ApConfigItem("15 dBm", 15),new ApConfigItem("16 dBm", 16), 
                                 new ApConfigItem("17 dBm", 17), new ApConfigItem("18 dBm", 18), 
                                 new ApConfigItem("用户未设置", 0)
                                      };
        //安全相关
        static public ApConfigItem[] 
            AP_WPA = { new ApConfigItem("WPA-PSK", 1), 
                         new ApConfigItem("WPA2-PSK", 2), 
                         new ApConfigItem("自动", 3) };
        static public ApConfigItem[] 
            AP_CYPHER = { new ApConfigItem("自动", "TKIPCCMP"), 
                            new ApConfigItem("CCMP", "CCMP"), 
                            new ApConfigItem("TKIP", "TKIP") };
        static public ApConfigItem[] 
            AP_WEP_MODE = { new ApConfigItem("开放系统", 1), 
                              new ApConfigItem("共享密钥", 2), 
                              new ApConfigItem("自动",4 ) };
        static public ApConfigItem[] 
            PASSWD_PATTERN = { new ApConfigItem("十六进制",0),
                                 new ApConfigItem("ASCII码",1) };
        static public ApConfigItem[] 
            PASSWD_MODE = {new ApConfigItem("禁用", 0), 
                              new ApConfigItem("64位", 64), 
                              new ApConfigItem("128位", 128), 
                              new ApConfigItem("152位", 152)};

        static public ApConfigItem[]
            WAN_CONNECT_TYPE = {new ApConfigItem("动态IP", 0), 
                              new ApConfigItem("静态IP", 1), 
                              new ApConfigItem("PPPoE", 2)};

        static public ApConfigItem find(ApConfigItem [] items, object value, out int index){
            index = 0;
            ApConfigItem item = null;
            for (int nIndex = 0; nIndex < items.Length; nIndex++)
            {
                if (items[nIndex].Value.Equals(value))
                {
                    item = items[nIndex];
                    index = nIndex;
                }
            }
            return item;
        }
    }
}
